package org.linuxgears.BouncingBall.mover;

import org.linuxgears.BouncingBall.mover.strategy.MovingStrategy;

public class SimpleMover<MovableType> implements Mover<MovableType> {

	private MovingStrategy movingStrategy;
	private MovingContext<MovableType> xtc;

	public SimpleMover(MovingStrategy movingStrategy) {
		this.movingStrategy = movingStrategy;
	}

	public MovingStrategy getMovingStrategy() {
		return movingStrategy;
	}

	public void setMovingStrategy(MovingStrategy movingStrategy) {
		if (movingStrategy != null) {
			this.movingStrategy = movingStrategy;
		}
	}

	@Override
	public void move() {
		movingStrategy.move();
		xtc.setPosition(movingStrategy.getPosition());		
	}

	public MovingContext<MovableType> getContext() {
		return xtc;
	}

	@Override
	public void setContext(MovingContext<MovableType> xtc) {
		this.xtc = xtc;
	}
	
}
